Total Complexity | 6 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm'; |
||
5 | |||
6 | @Entity() |
||
7 | export class DailyRate { |
||
8 | @PrimaryGeneratedColumn('uuid') |
||
9 | private id: string; |
||
10 | |||
11 | @Column({type: 'integer', nullable: false}) |
||
12 | private amount: number; |
||
13 | |||
14 | @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'}) |
||
15 | private createdAt: Date; |
||
16 | |||
17 | @ManyToOne(type => User, {nullable: false}) |
||
18 | private user: User; |
||
19 | |||
20 | @ManyToOne(type => Customer, {nullable: false}) |
||
21 | private customer: Customer; |
||
22 | |||
23 | @ManyToOne(type => Task, {nullable: false}) |
||
24 | private task: Task; |
||
25 | |||
26 | constructor(amount: number, user: User, customer: Customer, task: Task) { |
||
27 | this.amount = amount; |
||
28 | this.user = user; |
||
29 | this.customer = customer; |
||
30 | this.task = task; |
||
31 | } |
||
32 | |||
33 | public getId(): string { |
||
34 | return this.id; |
||
35 | } |
||
36 | |||
37 | public getAmount(): number { |
||
38 | return this.amount; |
||
39 | } |
||
40 | |||
41 | public getUser(): User { |
||
42 | return this.user; |
||
43 | } |
||
44 | |||
45 | public getTask(): Task { |
||
46 | return this.task; |
||
47 | } |
||
48 | |||
49 | public getCustomer(): Customer { |
||
50 | return this.customer; |
||
51 | } |
||
52 | |||
53 | public update( |
||
54 | amount: number, |
||
55 | user: User, |
||
56 | customer: Customer, |
||
57 | task: Task |
||
58 | ): void { |
||
59 | this.amount = amount; |
||
60 | this.user = user; |
||
61 | this.customer = customer; |
||
62 | this.task = task; |
||
63 | } |
||
65 |